package com.key.keypuzzlemodel

import android.app.Application
import android.content.Context
import kotlin.properties.Delegates

/**
 *
 * @describe:
 * @Time:      2023/2/15
 * @author:    阳
 */
class KeyApplication : Application() {

    companion object {
        var context: Context by Delegates.notNull()
            private set

        @JvmStatic
        fun getInstance(): KeyApplication = context as KeyApplication

        const val TAG = "Key Application"
    }


    /**
     * 日志记录
     */
    var fileName = ""
    var path: String = ""

    /**
     *  纵向：0 ，横向 ：1 ，宫格： 2，网页：3
     */
    var optionIndex = -1

    override fun onCreate() {
        super.onCreate()
        context = applicationContext

        // 注册全局异常处理类
        CrashExceptionHandler.newInstance().init(applicationContext)

        val timeMillis = System.currentTimeMillis()
        //错误日志文件名称
        fileName = "日志-$timeMillis.log"
        //文件存储位置
        path = externalCacheDir!!.path + "/crash_logInfo/"
    }
}